package com.weilai.common.service;

import com.weilai.common.dao.SysUserMapper;
import com.weilai.common.model.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Song on 2017/6/3.
 */
@Service
@Transactional
public class SysUserService {
    @Autowired
    SysUserMapper sysUserMapper;
    public Integer addSysUser(SysUser sysUser) {
        return sysUserMapper.insert(sysUser);
    }

    public Integer delSysUser(String sysUserId) {
        return sysUserMapper.deleteByPrimaryKey(Integer.parseInt(sysUserId));
    }

    public SysUser findAllOfMedal() {
        return sysUserMapper.findAllOfMedal();
    }

    public SysUser findByUser(SysUser sysUser) {
        return sysUserMapper.findByUser(sysUser);
    }

    public int updateBymobilenumberSelective(SysUser sysUser) {
        return sysUserMapper.updateBymobileNumberSelective(sysUser);
    }

    public List<SysUser> find() {
        return sysUserMapper.find();
    }

    public SysUser selectByPrimaryKey(Integer id) {
        return sysUserMapper.selectByPrimaryKey(id);
    }

    public int updateByIdSelective(SysUser sysUser) {
        return sysUserMapper.updateByIdSelective(sysUser);
    }

    @Transactional
    public SysUser frontFindByUser(SysUser sysUser) {
        return  sysUserMapper.frontFindByUser(sysUser);

    }
}
